package com.qf.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.dao.tokenDao;
import com.qf.entity.Token;
import com.qf.service.TokenService;
import com.qf.vo.PageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class tokenImpl implements TokenService {
    @Autowired
    private tokenDao tokenn;
    @Override
    @Transactional(rollbackFor = Exception.class)
    public PageInfo<Token> getAllToken(PageVo pageVo, Token token) {
        PageHelper.startPage(pageVo.getPage(),pageVo.getLimit());
        List<Token> lists= tokenn.getAllToken(token);
        return new PageInfo<>(lists);
    }

    @Override
    public Integer deleteUser(Integer[] ids) {
        return tokenn.deleteTokens(ids);
    }

    @Override
    public Integer addToken(Token token) {
        return tokenn.addToken(token);
    }

    @Override
    public Integer updateToken(Token token) {
        return tokenn.updateToken(token);
    }
}
